#pragma once

#include "ModelessDialog.h"

// CancelCloseDlg dialog

class CancelCloseDlg : public CModelessDialog, public L_Observer
{
	DECLARE_DYNAMIC(CancelCloseDlg)

	enum COMMAND_TYPES {
		CANCEL_ORDER,
		CANCEL_ALL_ORDERS,
		CANCEL_POSITION_ORDERS,
		CLOSE_ALL_POSITIONS
	};

public:
	CancelCloseDlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~CancelCloseDlg();

	virtual BOOL Create(CWnd *pParentWnd = CWnd::FromHandle(L_GetMainWnd()));

// Dialog Data
	enum { IDD = IDD_CANCELCLOSEDLG };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()

protected:
// L_Observer
	virtual void HandleMessage(L_Message const *pMsg);

private:
	L_Account *account;

	//controls
	CComboBox m_CommandTypeCombo;
	CComboBox m_OrderPosCombo;
	CButton m_EquityCheck;
	CButton m_FutureCheck;
	CButton m_OptionCheck;
	CButton m_LongCheck;
	CButton m_ShortCheck;
	CButton m_FlatCheck;
	CButton m_DayCheck;
	CButton m_NonDayCheck;
	CButton m_BuyCheck;
	CButton m_SellCheck;

	//control helpers
	void UpdateEnabledControls();
	void UpdateOrderPosCombo();

	//options
	int m_iCommandType;

public:
	virtual BOOL OnInitDialog();
	afx_msg void OnCbnSelchangeCommandTypeCombo();
	afx_msg void OnBnClickedExecute();
};
